package com.xsk.controller;

import com.xsk.domain.User;
import com.xsk.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService;

    @RequestMapping("index")
    public String index() {
        return "Hello";
    }

    @RequestMapping("name")
    public List<User> findUserByName(String userName) {
        return userService.findUserByName(userName);
    }

    @RequestMapping("id")
    public User findUserById(Integer id) {
        return userService.findUserById(id);
    }

}
